﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LoadingWK;

namespace WindowsFormsTest
{
    static class DateSampleFactory
    {
        static public AirplaneClr createAirplan_Yun20()
        {
            AirplaneClr airplane = new AirplaneClr();
            //运-20
            airplane._typeID = 20;
            airplane._length = 19500/*loadedLength*/;
            airplane._width = 3900/*LoadWidth*/;
            airplane._height = 3800/*LoadHeight*/;
            airplane._maxLoadWeight = 50000/*MaxLoadWeight*/;
            airplane._gravityY = 13684/*CenterPoint*/;
            airplane._minY = 12683.5/*MinCenterY*/;
            airplane._maxY = 13890.4/*MaxCenterY*/;
            airplane._weight = 50000/*Weight*/;
            airplane._locationTypeOfStartLoading = 1/*前端开始装载*/;

            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(1000/*leftY*/, 4859.789/*rightY*/, 10000/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(4859.789/*leftY*/, 7610.689/*rightY*/, 13000/*weight limit*/));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(7610.689/*leftY*/, 15897.479/*rightY*/, 55000/*weight limit*/));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(15897.479/*leftY*/, 19485.099/*rightY*/, 13000/*weight limit*/));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(19485.099/*leftY*/, 24635.099/*rightY*/, 10000/*weight limit*/));
            airplane._tag = "yun_20";
            
            return airplane;
        }
        static public AirplaneClr createAirplan_Yun8()
        {
            AirplaneClr airplane = new AirplaneClr();

            //运-8
            airplane._typeID = 8;
            airplane._length = 14500/*loadedLength*/;
            airplane._width = 2700/*LoadWidth*/;
            airplane._height = 2250/*LoadHeight*/;
            airplane._maxLoadWeight = 15000/*MaxLoadWeight*/;
            airplane._gravityY = 4880.77/*CenterPoint*/;
            airplane._minY = 4318.552/*MinCenterY*/;
            airplane._maxY = 5203.9565/*MaxCenterY*/;
            airplane._weight = 34000/*Weight*/;
            airplane._locationTypeOfStartLoading = 1/*后端开始装载*/;

            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(0/*leftY*/, 2748.68/*rightY*/, 1500/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(2748.68/*leftY*/, 5446.1308/*rightY*/, 3000/*weight limit*/));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(5446.1308/*leftY*/, 8566.181/*rightY*/, 6000/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(8566.181/*leftY*/, 11136.591/*rightY*/, 16000/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(11136.591/*leftY*/, 12175.18/*rightY*/, 8000/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(12175.18/*leftY*/, 15665.18/*rightY*/, 1500/*weight limit*/ ));
            airplane._tag = "yun_8";

            return airplane;
        }
        static public AirplaneClr createAirplan_Yun9()
        {
            AirplaneClr airplane = new AirplaneClr();

            //运-9
            airplane._typeID = 9;
            airplane._length = 16426/*loadedLength*/;
            airplane._width = 3120/*LoadWidth*/;
            airplane._height = 2462/*LoadHeight*/;
            airplane._maxLoadWeight = 20000/*MaxLoadWeight*/;
            airplane._gravityY = 4880.77/*CenterPoint*/;
            airplane._minY = 4218.5517/*MinCenterY*/;
            airplane._maxY = 5303.9563/*MaxCenterY*/;
            airplane._weight = 35000/*Weight*/;
            airplane._locationTypeOfStartLoading = 1/*后端开始装载*/;

            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(0/*leftY*/, 2100/*rightY*/, 1500/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(2100/*leftY*/, 8600/*rightY*/, 12000/*weight limit*/));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(8600/*leftY*/, 11676/*rightY*/, 20000/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(11676/*leftY*/, 12926/*rightY*/, 8000/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(12926/*leftY*/, 19926/*rightY*/, 1500/*weight limit*/ ));
            airplane._tag = "yun_9";

            return airplane;
        }
        static public AirplaneClr createAirplan_YiEr76()
        {
            AirplaneClr airplane = new AirplaneClr();

            //运-76
            airplane._typeID = 76;
            airplane._length = 18000/*loadedLength*/;
            airplane._width = 3400/*LoadWidth*/;
            airplane._height = 3350/*LoadHeight*/;
            airplane._maxLoadWeight = 45000/*MaxLoadWeight*/;
            airplane._gravityY = 7660.399/*CenterPoint*/;
            airplane._minY = 6245.393/*MinCenterY*/;
            airplane._maxY = 8275.4017/*MaxCenterY*/;
            airplane._weight = 95000/*Weight*/;
            airplane._locationTypeOfStartLoading = 1/*后端开始装载*/;

            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(0/*leftY*/, 9233.789/*rightY*/, 7500/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(9233.789/*leftY*/, 15750.069/*rightY*/, 11000/*weight limit*/));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(15750.069/*leftY*/, 18432.239/*rightY*/, 11000/*weight limit*/ ));
            airplane._weightLimitOfAreaList.Add(new WeightLimitClr(18432.239/*leftY*/, 23422.239/*rightY*/, 5000/*weight limit*/ ));
            airplane._tag = "yun_76";

            return airplane;
        }


        static public EquipmentClr createEquipment(
           Int32 id,
           double Length, double Width, double Height,
           double Weight, double Focus_PositionY,
           List<AxleLoadClr> axleLoads, List<int> airplaneTypeIds)
        {
            EquipmentClr equip1 = new EquipmentClr();
            equip1._id = id;
            equip1._length = Length;
            equip1._width = Width;
            equip1._height = Height;
            equip1._weight = Weight;
            equip1._gravityY = Focus_PositionY;
            if (axleLoads == null)
            {
                equip1.addAxleLoad(new AxleLoadClr(Focus_PositionY, Weight));
            }
            else
            {
                if (axleLoads.Count == 0)
                {
                    equip1.addAxleLoad(new AxleLoadClr(Focus_PositionY, Weight));
                }
                else
                {
                    foreach (AxleLoadClr ax in axleLoads)
                    {
                        equip1.addAxleLoad(ax);
                    }
                }
            }
            if (airplaneTypeIds != null)
            {
                foreach (int typeId in airplaneTypeIds)
                {
                    equip1._adaptedAirplaneTypeIDs.Add(typeId);
                }
            }

            return equip1;
        }

        static public List<AirplaneClr> createAirplanList()
        {
            List<AirplaneClr> airplaneClrs = new List<AirplaneClr>(0);
            
            airplaneClrs.Add(createAirplan_Yun8());
            airplaneClrs.Add(createAirplan_Yun9());
            airplaneClrs.Add(createAirplan_YiEr76());
            airplaneClrs.Add(createAirplan_Yun20());

            return airplaneClrs;
        }

        static public List<EquipmentClr> createEquipmentList_2()
        {
            List<EquipmentClr> equipmentList = new List<EquipmentClr>();
            Int32 equipID = 1;

            List<int> adaptateAirplaneTypeIDList = new List<int> { 8,20 };
            equipmentList.Add(
                createEquipment(equipID++/*id*/, 3000/*Length*/, 3000/*width*/, 2000/*height*/, 5000/*Weight*/, 1500/*Focus_PositionY*/,
                null, adaptateAirplaneTypeIDList));
            equipmentList.Add(
                createEquipment(equipID++/*id*/, 3000/*Length*/, 3000/*width*/, 2000/*height*/, 5000/*Weight*/, 1500/*Focus_PositionY*/,
                null, adaptateAirplaneTypeIDList));
            equipmentList.Add(
                createEquipment(equipID++/*id*/, 3000/*Length*/, 3000/*width*/, 2000/*height*/, 5000/*Weight*/, 1500/*Focus_PositionY*/,
                null, adaptateAirplaneTypeIDList));

            List<AxleLoadClr> axleLoads = new List<AxleLoadClr> {
                new AxleLoadClr(1000/*Focus_PositionY*/, 7000 /*Weight limit*/),
                new AxleLoadClr(5000/*Focus_PositionY*/, 5000 /*Weight limit*/) };
            equipmentList.Add(
                createEquipment(equipID++/*id*/, 6000/*Length*/, 2500/*width*/, 2200/*height*/, 12000/*Weight*/, 2500/*Focus_PositionY*/,
                axleLoads, adaptateAirplaneTypeIDList));
            equipmentList.Add(
                createEquipment(equipID++/*id*/, 6000/*Length*/, 2500/*width*/, 2200/*height*/, 12000/*Weight*/, 2500/*Focus_PositionY*/,
                axleLoads, adaptateAirplaneTypeIDList));

            return equipmentList;
        }
        static public List<EquipmentClr> createEquipmentList()
        {
            List<EquipmentClr> equipmentList = new List<EquipmentClr>();
            Int32 equipID = 1;


            //List<AxleLoadClr> axleLoads = new List<AxleLoadClr> {
            //    new AxleLoadClr(1600/*Focus_PositionY*/, 7212 /*Weight limit*/),
            //    new AxleLoadClr(2700/*Focus_PositionY*/, 7212 /*Weight limit*/),
            //    new AxleLoadClr(7900/*Focus_PositionY*/, 9050/*Weight limit*/) ,
            //    new AxleLoadClr(9200/*Focus_PositionY*/, 9050 /*Weight limit*/)  };
            //equipmentList.Add(
            //    createEquipment(equipID++/*id*/, 11770/*Length*/, 2900/*width*/, 3450/*height*/, 32000/*Weight*/, 5000/*Focus_PositionY*/,
            //    axleLoads, new List<int> {20 }));//导弹车

            List<AxleLoadClr>  axleLoads = new List<AxleLoadClr> {
                new AxleLoadClr(1099.895/*Focus_PositionY*/, 2500/*Weight limit*/) };
            for (int i = 0; i < 4; i++)
            {
                equipmentList.Add(
                    createEquipment(equipID++/*id*/, 2199.79/*Length*/, 1662.47/*width*/, 1918.82/*height*/, 2500/*Weight*/, 1099.895/*Focus_PositionY*/,
                        axleLoads, new List<int> { 8, 9, 76, 20 }));
            }
            
            //axleLoads = new List<AxleLoadClr> {
            //    new AxleLoadClr(4216.5/*Focus_PositionY*/, 7860/*Weight limit*/) };
            //equipmentList.Add(
            //    createEquipment(equipID++/*id*/, 8433/*Length*/, 2496/*width*/, 2968/*height*/, 7860/*Weight*/, 4216.5/*Focus_PositionY*/,
            //    axleLoads, new List<int> {76, 20 }));//运输车

            //axleLoads = new List<AxleLoadClr> {
            //    new AxleLoadClr(4216.5/*Focus_PositionY*/, 5000/*Weight limit*/) };
            //equipmentList.Add(
            //    createEquipment(equipID++/*id*/, 8309.69/*Length*/, 2993.16/*width*/, 2548.97/*height*/, 5000/*Weight*/, 4154.845/*Focus_PositionY*/,
            //    axleLoads, new List<int> { 76, 20 }));
            
            return equipmentList;
        }
    }
}
